import Vue from 'vue'
import VueRouter from 'vue-router'

Vue.use(VueRouter)

const routes = [
  {
    path: '/',
    redirect: '/login'
  },
  {
    path: '/home',
    component: function () {
      return import(/* webpackChunkName: "about" */ '../views/Home.vue')
    },
    children: [
      {
        path: '/home',
        redirect: '/home/worktable'
      },
      {
        path: '/home/worktable',
        component: function () {
          return import(/* webpackChunkName: "about" */ '../views/Worktable')
        },
      },
      {
        path: '/home/commodity',
        component: function () {
          return import(/* webpackChunkName: "about" */ '../views/Commodity')
        },
      },
      {
        path: '/home/marketing',
        component: function () {
          return import(/* webpackChunkName: "about" */ '../views/Marketing')
        },
      },
      {
        path: '/home/order',
        component: function () {
          return import(/* webpackChunkName: "about" */ '../views/Order')
        },
      },
      {
        path: '/home/commander',
        component: function () {
          return import(/* webpackChunkName: "about" */ '../views/Commander')
        },
        children:[
          {
            path:'/home/commander/regulator',
            component: function () {
              return import(/* webpackChunkName: "about" */ '../views/Commander/regulator.vue')
            },
          },
          {
            path:'/home/commander/check',
            component: function () {
              return import(/* webpackChunkName: "about" */ '../views/Commander/check.vue')
            },
          },
          {
            path:'/home/commander/grade',
            component: function () {
              return import(/* webpackChunkName: "about" */ '../views/Commander/grade.vue')
            },
          },
          {
            path:'/home/commander/setting',
            component: function () {
              return import(/* webpackChunkName: "about" */ '../views/Commander/setting.vue')
            },
          },
          {
            path:'/home/commander/course',
            component: function () {
              return import(/* webpackChunkName: "about" */ '../views/Commander/course.vue')
            },
          },
          {
            path:'/home/commander/commission',
            component: function () {
              return import(/* webpackChunkName: "about" */ '../views/Commander/commission.vue')
            },
          }
        ]
      },
      {
        path: '/home/store',
        component: function () {
          return import(/* webpackChunkName: "about" */ '../views/Store')
        },
      },
      {
        path: '/home/shop',
        component: function () {
          return import(/* webpackChunkName: "about" */ '../views/Shop')
        },
      },
      {
        path: '/home/distribution',
        component: function () {
          return import(/* webpackChunkName: "about" */ '../views/Distribution')
        },
      },
      {
        path: '/home/program',
        component: function () {
          return import(/* webpackChunkName: "about" */ '../views/Program')
        },
      },
      {
        path: '/home/jurisdiction',
        component: function () {
          return import(/* webpackChunkName: "about" */ '../views/Jurisdiction')
        },
      }
    ]
  },
  {
    path: '/login',
    component: function () {
      return import(/* webpackChunkName: "about" */ '../views/Login')
    },
  },
]

const router = new VueRouter({
  mode: 'history',
  base: process.env.BASE_URL,
  routes
})

export default router
